package com.siyoumi.app.modules.app_book.service.handle_order;

import com.siyoumi.app.entity.BookOrder;
import com.siyoumi.app.modules.app_book.service.BookOrderHandleAbs;
import com.siyoumi.component.LogPipeLine;
import com.siyoumi.exception.EnumSys;
import com.siyoumi.service.IWebService;
import com.siyoumi.util.XReturn;

public class BookOrderHandle85GiveFun
        extends BookOrderHandleAbs
        implements IWebService {
    @Override
    public XReturn orderBeforeCheck() {
        return EnumSys.OK.getR();
    }

    @Override
    public String getTitle() {
        return "积分赠送"; //下单送积分给下单人
    }

    @Override
    public XReturn handle(BookOrder entityOrder) {
        //Boolean existOrder = SvcBookOrder.getBean().existOrderFirstEnable(entityOrder.getBorder_uid());
        //String masterUid = "";
        //entityOrder.setBorder_give_fun(0L);
        //if (!existOrder) {
        //    LogPipeLine.getTl().setLogMsg("积分赠送->第1次下单");
        //    SysMaster entityMaster = SvcSysMaster.getBean().getEntity(getOpenid());
        //    if (entityMaster != null) {
        //        LogPipeLine.getTl().setLogMsg("积分赠送->有主人");
        //        masterUid = entityMaster.getMast_uid();
        //        entityOrder.setBorder_give_uid(masterUid);
        //        entityOrder.setBorder_give_fun(SvcBookOrder.getBean().giveFunNum()); //标记加1千积分
        //    }
        //} else {
        //    LogPipeLine.getTl().setLogMsg("积分赠送->非第1次下单");
        //}
        entityOrder.setBorder_give_fun(entityOrder.getBorder_price_spu().longValue()); //1元送1分
        entityOrder.setBorder_give_uid(entityOrder.getBorder_uid());
        getLog().setLogMsgFormat("赠送积分：{0}", entityOrder.getBorder_give_fun().toString());

        return EnumSys.OK.getR();
    }
}
